module.exports = {
  "stories": [
    "../src/**/*.stories.mdx",
    "../src/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  // "addons": [
  //   "@storybook/preset-create-react-app",
  //   "@storybook/addon-essentials",  
  //   "@storybook/addon-actions",
  //   { name: "@storybook/addon-docs", options: { configureJSX: true } },
  //   "@storybook/addon-controls",
  //   "@storybook/addon-links",
	// 	"@storybook/addon-viewport",
  //   "@storybook/addon-knobs",
	// 	"@storybook/addon-a11y",
	// 	"@storybook/addon-storysource",
  // ],
  "addons": [
    "@storybook/preset-create-react-app",
    // "@storybook/addon-essentials",  
    "@storybook/addon-actions",
    "@storybook/addon-links",
    "@storybook/addon-viewport",
    "@storybook/addon-knobs",
    { name: "@storybook/addon-docs", options: { configureJSX: true } },
    "@storybook/addon-controls",
		"@storybook/addon-a11y",
		"@storybook/addon-storysource",
  ],
  // 由于doc插件不支持ts，为了使doc插件支持typescript，以及story支持tsx，将配置进行更改
  webpackFinal: async (config) => {
    config.module.rules.push({
      test: /\.(ts|tsx)$/,
      use: [
        // {
        //   loader: require.resolve("awesome-typescript-loader")
        // },
        {
          loader: require.resolve("react-docgen-typescript-loader")
        },
        {
					loader: require.resolve("react-docgen-typescript-loader"),
					options: {
						shouldExtractLiteralValuesFromEnum: true,
						propFilter: prop => {
							if (prop.parent) {
								return !prop.parent.fileName.includes('node_modules')
							}
							return true
						}
					}
				}
      ]
    })
    config.resolve.extensions.push('.ts', '.tsx', '.d.ts')
    return config
  }
}